import 'package:freezed_annotation/freezed_annotation.dart';
import 'dart:convert';

part 'login_token_login_response.freezed.dart';
part 'login_token_login_response.g.dart';

@freezed
class LoginTokenLoginResponse with _$LoginTokenLoginResponse {
  const factory LoginTokenLoginResponse({
    @JsonKey(name: "code") required int code,
    @JsonKey(name: "msg") required String msg,
    @JsonKey(name: "time") required int time,
    @JsonKey(name: "data") required Data data,
  }) = _LoginTokenLoginResponse;

  factory LoginTokenLoginResponse.fromJson(Map<String, dynamic> json) =>
      _$LoginTokenLoginResponseFromJson(json);
}

@freezed
class Data with _$Data {
  const factory Data({
    @JsonKey(name: "login_token") required String loginToken,
    @JsonKey(name: "user_id") required int userId,
  }) = _Data;

  factory Data.fromJson(Map<String, dynamic> json) => _$DataFromJson(json);
}
